package com.edu.javaweb.mapper;

import com.edu.javaweb.pojo.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentMapper {
    @Select("select * from student")
    List<Student> findAll();
    @Update("update student set " +
            "name=#{name}," +
            "sex=#{sex}," +
            "specialized=#{specialized}," +
            "telephone=#{telephone}," +
            "stu_class=#{stuClass}," +
            "password=#{password} " +
            "where id=#{id}")
    void upById(Student student);
    @Delete("delete from student where id=#{id}")
    void delById(Integer id);

    @Insert("insert into student values " +
            "(null,#{name},#{sex},#{specialized},#{telephone},#{stuClass},#{password})")
    void insStudent(Student student);

    @Select("select * from student where name=#{account}")
    Student findByName(String account);

    @Select("select * from student where name=#{account}")
    Student getStudent(String account);
}
